
 /* OVERVIEW OF DO FILE TO CREATE RESULTS IN APPENDIX B
We have four congresses 109-112. We will do the matching separately for each Congress and then do a pooled analysis as well. 

These analyses use the pink measure of working class and the Clausen measure of Social Welfare legislation
The Intro Clausen variable is coded 1 if a Legislator introduced a bill coded as social welfare legislation in a given congress. 

*/
 
clear
*cd "/Users/nweller/Dropbox/class_pcs_project/ClassSession_Final/PRQ Revisions/Data"
 
use "LegislatorDataPCS.dta"

*cd "/Users/nweller/Dropbox/class_pcs_project/ClassSession_Final/PRQ Revisions/Data/Appendices/MorganResults"
 
*log using "MorganResults.log", replace


replace median_hh=median_hh/1000



**Results for Probability of Introduction

**109th Congresses
table member_wc_morgan if cong==109

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share party if cong==109, tr(member_wc_morgan)

cem median_hh(#3) share_black party share_latino dist_pct_union dem_vote_share party   if cong==109, tr(member_wc_morgan)

gen T109 =member_wc_morgan 
label variable T109 "109th Congress"

eststo cong109social:logit intro_clausen T109 median_hh share_black party share_latino  dist_pct_union party dem_vote_share [iweight=cem_weights] if cong==109 

estimate store cong109social

outreg2 using IntroMorgan.xls, replace title("Effect of Working-Class Legislator on Bill Introduction") ///
label ctitle("109th Congress Social Welfare")

margins, dydx(T109) post
estimates store Cong109

ren cem_matched cem_matched109
table cem_matched109



*110th Congresses
table member_wc_morgan if cong==110

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share  party if cong==110, tr(member_wc_morgan)

cem median_hh(#3) share_black party share_latino  dist_pct_union dem_vote_share party  if cong==110, tr(member_wc_morgan)

gen T110 =member_wc_morgan 
label variable T110 "110th Congress" 

eststo cong110social:logit intro_clausen T110 median_hh share_black party share_latino party  dist_pct_union dem_vote_share [iweight=cem_weights] if cong==110

estimate store cong110social
outreg2 using IntroMorgan.xls, append title("Effect of Working-Class Legislator on Bill Introduction") ///
label ctitle("110th Congress Social Welfare ")

margins, dydx(T110) post
estimates store Cong110

ren cem_matched cem_matched110
table cem_matched110




*111th Congresses
table member_wc_morgan if cong==111

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share party if cong==111, tr(member_wc_morgan)

cem median_hh(#3) share_black party share_latino  dist_pct_union dem_vote_share party if cong==111, tr(member_wc_morgan)

gen T111 =member_wc_morgan 
label variable T111 "111th Congress" 

eststo cong111social: logit intro_clausen T111 median_hh share_black party share_latino  dist_pct_union party dem_vote_share [iweight=cem_weights] if cong==111

estimate store cong111social

outreg2 using IntroMorgan.xls, append title("Effect of Working-Class Legislator on Bill Introduction") ///
label ctitle("111th Congress Social Welfare ")

margins, dydx(T111) post
estimates store Cong111

ren cem_matched cem_matched111
table cem_matched111


*112th Congresses
table member_wc_morgan if cong==112

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share party if cong==112, tr(member_wc_morgan)

cem median_hh(#3) share_black party share_latino  dist_pct_union dem_vote_share party if cong==112, tr(member_wc_morgan)

gen T112 =member_wc_morgan 
label variable T112 "112th Congress"

eststo cong112social:logit intro_clausen T112 median_hh share_black party share_latino  dist_pct_union party dem_vote_share [iweight=cem_weights] if cong==112

estimate store cong112social

outreg2 using IntroMorgan.xls, append title("Effect of Working-Class Legislator on Bill Introduction") ///
label ctitle("112th Congress Social Welfare ")

margins, dydx(T112) post
estimates store Cong112

ren cem_matched cem_matched112
table cem_matched112


**All Congresses 
quietly tabulate cong, generate(new_congress)
table member_wc_morgan

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share cong party, tr(member_wc_morgan)

cem median_hh(#3) share_black party share_latino  dist_pct_union dem_vote_share cong party, tr(member_wc_morgan)

gen Tall =member_wc_morgan 
label variable Tall "All Congresses"

eststo AllCongSocial:logit intro_clausen Tall median_hh share_black party share_latino  dist_pct_union dem_vote_share i.cong [iweight=cem_weights] 

estimate store AllCongSocial

outreg2 using IntroMorgan.xls, append title("Effect of Working-Class Legislator on Bill Introduction") ///
label ctitle("All Congresses Social Welfare ")

margins, dydx(Tall) post
estimates store CongAll

ren cem_matched cem_matchedALL
table cem_matchedALL


label variable T109 `""109th Congress" "2005-07""'
label variable T110 `""110th Congress" "2007-09""'
label variable T111 `""111th Congress" "2009-11""'
label variable T112 `""112th Congress" "2011-13""' 
label variable Tall `""All Congresses" "2007-13""' 


**Plot of Coefficient Estimates 
	
	coefplot ///
    (Cong109, msymbol(O) mcolor(black) lcolor(black)) ///
    (Cong110, msymbol(O) mcolor(black) lcolor(black)) ///
    (Cong111, msymbol(O) mcolor(black) lcolor(black)) ///
    (Cong112, msymbol(O) mcolor(black) lcolor(black)) ///
    (CongAll, msymbol(O) mcolor(black) lcolor(black)) ///
    , ///
    scheme(s1mono) ///
    xline(0) ///
    level(90) ///
    legend(off) ///
	offset (0) ///
	 ciopts(recast(rcap) lcolor(black)) ///
    xtitle(Probability of Introduction)

	graph save IntroMorgan.gph, replace
	

**Results for Sum of Intros with Morgan Measure

clear

*cd "/Users/nweller/Dropbox/class_pcs_project/ClassSession_Final/PRQ Revisions/Data"
 
use "LegislatorDataPCS.dta"

*cd "/Users/nweller/Dropbox/class_pcs_project/ClassSession_Final/PRQ Revisions/Data/Appendices/MorganResults"
 
 replace median_hh=median_hh/1000

**109th Congresses
table member_wc_morgan if cong==109

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share party if cong==109, tr(member_wc_morgan)

cem median_hh(#3) share_black party share_latino  dist_pct_union dem_vote_share party   if cong==109, tr(member_wc_morgan)

gen T109 =member_wc_morgan 
label variable T109 "109th Congress"

eststo cong109sum:reg sum_clausen_soc_welfare T109 median_hh share_black party share_latino  dist_pct_union  dem_vote_share [iweight=cem_weights] if cong==109 , robust

estimate store cong109social

ren cem_matched cem_matched109
table cem_matched109

outreg2 using MorganSumIntros.xls, replace title("Effect of Working-Class Legislator on Number Bill Introductions") ///
label ctitle("109th Congress Social Welfare")


*110th Congresses
table member_wc_morgan if cong==110

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share  party if cong==110, tr(member_wc_morgan)

cem median_hh(#3) share_black party share_latino  dist_pct_union dem_vote_share party  if cong==110, tr(member_wc_morgan)

gen T110 =member_wc_morgan 
label variable T110 "110th Congress"

eststo cong110social:reg sum_clausen_soc_welfare T110 median_hh share_black party share_latino   dist_pct_union dem_vote_share [iweight=cem_weights] if cong==110, robust

estimate store cong110social

ren cem_matched cem_matched110
table cem_matched110

outreg2 using MorganSumIntros.xls, append title("Effect of Working-Class Legislator on Number Bill Introductions") ///
label ctitle("110th Congress Social Welfare")

*111th Congresses
table member_wc_morgan if cong==111

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share party if cong==111, tr(member_wc_morgan)

cem median_hh(#3) share_black party share_latino  dist_pct_union dem_vote_share party if cong==111, tr(member_wc_morgan)

gen T111 =member_wc_morgan 
label variable T111 "111th Congress"

eststo cong111social: reg sum_clausen_soc_welfare T111 median_hh share_black party share_latino  dist_pct_union  dem_vote_share [iweight=cem_weights] if cong==111, robust

estimate store cong111social

ren cem_matched cem_matched111
table cem_matched111


outreg2 using MorganSumIntros.xls, append title("Effect of Working-Class Legislator on Number Bill Introductions") ///
label ctitle("111th Congress Social Welfare")

*112th Congresses
table member_wc_morgan if cong==112

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share party if cong==112, tr(member_wc_morgan)

cem median_hh(#3) share_black party share_latino  dist_pct_union dem_vote_share party if cong==112, tr(member_wc_morgan)

gen T112 =member_wc_morgan 
label variable T112 "112th Congress"

eststo cong112social:reg sum_clausen_soc_welfare T112 median_hh share_black party share_latino  dist_pct_union  dem_vote_share [iweight=cem_weights] if cong==112, robust

estimate store cong112social

ren cem_matched cem_matched112
table cem_matched112

outreg2 using MorganSumIntros.xls, append title("Effect of Working-Class Legislator on Number Bill Introductions") ///
label ctitle("112th Congress Social Welfare")

**All Congresses 
quietly tabulate cong, generate(new_congress)
table member_wc_morgan

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share cong party, tr(member_wc_morgan)

cem median_hh(#3) share_black party share_latino  dist_pct_union dem_vote_share cong party, tr(member_wc_morgan)

gen Tall =member_wc_morgan 
label variable Tall "All Congresses"

eststo AllCongSocial:reg sum_clausen_soc_welfare Tall median_hh share_black party share_latino  dist_pct_union party dem_vote_share i.cong [iweight=cem_weights] , robust

estimate store AllCongSocial

ren cem_matched cem_matchedALL
table cem_matchedALL

outreg2 using MorganSumIntros.xls, append title("Effect of Working-Class Legislator on Number Bill Introductions") ///
label ctitle("All Congresses Social Welfare")


coefplot ///
    (cong109social,  label("109") msymbol(O) mcolor(black) lcolor(black)) ///
    (cong110social, label("110") msymbol(O) mcolor(black) lcolor(black)) ///
    (cong111social, label("111") msymbol(O) mcolor(black) lcolor(black)) ///
    (cong112social, label("112") msymbol(O) mcolor(black) lcolor(black)) ///
    (AllCongSocial, label("All") msymbol(O) mcolor(black) lcolor(black)), ///
    keep (T109 T110 T111 T112 Tall) ///
    scheme(s1mono) ///
    xline(0) ///
    level(90) ///
    legend(off) ///
	offset (0) ///
	ciopts(recast(rcap) lcolor(black)) ///
    xtitle(Number of Bills)

graph save SumIntrosMorgan.gph, replace
	

**Results for Average PCS on Social Welfare legislation


clear
*cd "/Users/nweller/Dropbox/class_pcs_project/ClassSession_Final/PRQ Revisions/Data"
 
use "LegislatorDataPCS.dta"

*cd "/Users/nweller/Dropbox/class_pcs_project/ClassSession_Final/PRQ Revisions/Data/Appendices/MorganResults"
 

replace median_hh=median_hh/1000

**109th Congresses
table member_wc_morgan if cong==109

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share party if cong==109, tr(member_wc_morgan)

cem median_hh(#3) share_black party share_latino dist_pct_union dem_vote_share    if cong==109, tr(member_wc_morgan)

gen T109 =member_wc_morgan 
label variable T109 "109th Congress"

eststo cong109social:reg mean_PCS1 T109 median_hh share_black party share_latino  dist_pct_union  dem_vote_share [iweight=cem_weights] if cong==109 

estimate store cong109social

outreg2 using MeanPCSMorgan.xls, replace title("Effect of Working-Class Legislator") ///
label ctitle("109th Congress Social Welfare")

rename (cem*) (_109_cem*)


*110th Congresses
table member_wc_morgan if cong==110

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share  party if cong==110, tr(member_wc_morgan)

cem median_hh(#3) share_black  share_latino  dist_pct_union dem_vote_share party  if cong==110, tr(member_wc_morgan)

gen T110 =member_wc_morgan 
label variable T110 "110th Congress"

eststo cong110social:reg mean_PCS1 T110 median_hh share_black party share_latino   dist_pct_union dem_vote_share [iweight=cem_weights] if cong==110

estimate store cong110social

outreg2 using MeanPCSMorgan.xls, append title("Effect of Working-Class Legislator") ///
label ctitle("110th Congress Social Welfare ")

rename (cem*) (_110_cem*)


*111th Congresses
table member_wc_morgan if cong==111

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share party if cong==111, tr(member_wc_morgan)

cem median_hh(#3) share_black  share_latino  dist_pct_union dem_vote_share party if cong==111, tr(member_wc_morgan)

gen T111 =member_wc_morgan 
label variable T111 "111th Congress"

eststo cong111social:reg mean_PCS1 T111 median_hh share_black party share_latino  dist_pct_union  dem_vote_share [iweight=cem_weights] if cong==111

estimate store cong111social

outreg2 using MeanPCSMorgan.xls, append title("Effect of Working-Class Legislator") ///
label ctitle("111th Congress Social Welfare ")
rename (cem*) (_111_cem*)



*112th Congresses
table member_wc_morgan if cong==112

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share party if cong==112, tr(member_wc_morgan)

cem median_hh(#3) share_black  share_latino  dist_pct_union dem_vote_share party if cong==112, tr(member_wc_morgan)

gen T112 =member_wc_morgan 
label variable T112 "112th Congress"

eststo cong112social:reg mean_PCS1 T112 median_hh share_black party share_latino  dist_pct_union  dem_vote_share [iweight=cem_weights] if cong==112
estimate store cong112social

outreg2 using MeanPCSMorgan.xls, append title("Effect of Working-Class Legislator") ///
label ctitle("112th Congress Social Welfare ")

rename (cem*) (_112_cem*)


**All Congresses 
quietly tabulate cong, generate(new_congress)
table member_wc_morgan

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share cong party, tr(member_wc_morgan)

cem median_hh(#3) share_black  share_latino  dist_pct_union dem_vote_share cong party, tr(member_wc_morgan)

gen Tall =member_wc_morgan 
label variable Tall "All Congresses"

eststo AllCongSocial:reg mean_PCS1 Tall median_hh share_black party share_latino  dist_pct_union  dem_vote_share i.cong [iweight=cem_weights] 
estimate store AllCongSocial

outreg2 using MeanPCSMorgan.xls, append title("Effect of Working-Class Legislator") ///
label ctitle("All Congresses Social Welfare ")


rename (cem*) (_AllCong_cem*)

label variable T109 `""109th Congress" "2005-07""'
label variable T110 `""110th Congress" "2007-09""'
label variable T111 `""111th Congress" "2009-11""'
label variable T112 `""112th Congress" "2011-13""' 
label variable Tall `""All Congresses" "2007-13""' 


**Plot of Working Class Background on Mean PCS Scores
	coefplot ///
    (cong109social,  label("109") msymbol(O) mcolor(black) ) ///
    (cong110social, label("110") msymbol(O) mcolor(black) ) ///
    (cong111social, label("111") msymbol(O) mcolor(black)) ///
    (cong112social, label("112") msymbol(O) mcolor(black)) ///
    (AllCongSocial, label("All") msymbol(O) mcolor(black) ), ///
    keep (T109 T110 T111 T112 Tall) ///
    scheme(s1mono) ///
    xline(0) ///
    level(90) ///
    legend(off) ///
	 ciopts(recast(rcap) lcolor(black)) ///
	 offset (0) ///
    xtitle(Average PCS Score)
	
	graph save MeanPCSMorgan.gph, replace
	

**Results for the Maximum Value of the PCS 
	
clear
*cd "/Users/nweller/Dropbox/class_pcs_project/ClassSession_Final/PRQ Revisions/Data"
 
use "LegislatorDataPCS.dta"

*cd "/Users/nweller/Dropbox/class_pcs_project/ClassSession_Final/PRQ Revisions/Data/Appendices/MorganResults"

replace median_hh=median_hh/1000

**109th Congresses
table member_wc_morgan if cong==109

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share party if cong==109, tr(member_wc_morgan)

cem median_hh(#3) share_black party share_latino  dist_pct_union dem_vote_share party   if cong==109, tr(member_wc_morgan)

gen T109 =member_wc_morgan 
label variable T109 "109th Congress"

eststo cong109social:reg max_PCS1 T109 median_hh share_black party share_latino  dist_pct_union party dem_vote_share [iweight=cem_weights] if cong==109 

outreg2 using MaxPCSMorgan.xls, replace title("Effect of Working-Class Legislator") ///
label ctitle("109th Congress Social Welfare")

rename (cem*) (_109_cem*)


*110th Congresses
table member_wc_morgan if cong==110

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share  party if cong==110, tr(member_wc_morgan)

cem median_hh(#3) share_black party share_latino  dist_pct_union dem_vote_share party  if cong==110, tr(member_wc_morgan)

gen T110 =member_wc_morgan 
label variable T110 "110th Congress"

eststo cong110social:reg max_PCS1 T110 median_hh share_black party share_latino party  dist_pct_union dem_vote_share [iweight=cem_weights] if cong==110

*estimate store cong110social

outreg2 using MaxPCSMorgan.xls, append title("Effect of Working-Class Legislator") ///
label ctitle("110th Congress Social Welfare ")

rename (cem*) (_110_cem*)


*111th Congresses
table member_wc_morgan if cong==111

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share party if cong==111, tr(member_wc_morgan)

cem median_hh(#3) share_black party share_latino  dist_pct_union dem_vote_share party if cong==111, tr(member_wc_morgan)

gen T111 =member_wc_morgan 
label variable T111 "111th Congress"
eststo cong111social:reg max_PCS1 T111 median_hh share_black party share_latino  dist_pct_union party dem_vote_share [iweight=cem_weights] if cong==111

*estimate store cong111social

outreg2 using MaxPCSMorgan.xls, append title("Effect of Working-Class Legislator") ///
label ctitle("111th Congress Social Welfare ")

rename (cem*) (_111_cem*)


*112th Congresses
table member_wc_morgan if cong==112

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share party if cong==112, tr(member_wc_morgan)

cem median_hh(#3) share_black party share_latino  dist_pct_union dem_vote_share party if cong==112, tr(member_wc_morgan)

gen T112 =member_wc_morgan 
label variable T112 "112th Congress"

eststo cong112social:reg max_PCS1 T112 median_hh share_black party share_latino  dist_pct_union party dem_vote_share [iweight=cem_weights] if cong==112
*estimate store cong112social

outreg2 using MaxPCSMorgan.xls, append title("Effect of Working-Class Legislator") ///
label ctitle("112th Congress Social Welfare ")

rename (cem*) (_112_cem*)


**All Congresses 
quietly tabulate cong, generate(new_congress)
table member_wc_morgan

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share cong party, tr(member_wc_morgan)

cem median_hh(#3) share_black party share_latino  dist_pct_union dem_vote_share cong party, tr(member_wc_morgan)

gen Tall =member_wc_morgan 
label variable Tall "All Congresses"

eststo AllCongSocial:reg max_PCS1 Tall median_hh share_black party share_latino  dist_pct_union party dem_vote_share i.cong [iweight=cem_weights] 
*estimate store AllCongSocial

outreg2 using MaxPCSMorgan.xls, append title("Effect of Working-Class Legislator") ///
label ctitle("All Congresses Social Welfare ")

rename (cem*) (_AllCong_cem*)



**Plot of Working Class Background on Max PCS Scores
	coefplot ///
    (cong109social,  label("109") msymbol(O) mcolor(black) ) ///
    (cong110social, label("110") msymbol(O) mcolor(black) ) ///
    (cong111social, label("111") msymbol(O) mcolor(black)) ///
    (cong112social, label("112") msymbol(O) mcolor(black)) ///
    (AllCongSocial, label("All") msymbol(O) mcolor(black) ), ///
    keep (T109 T110 T111 T112 Tall) ///
    scheme(s1mono) ///
    xline(0) ///
    level(90) ///
    legend(off) ///
	 ciopts(recast(rcap) lcolor(black)) ///
	 offset(0) ///
    xtitle(Maximum PCS Score)
	
	graph save MaxPCSMorgan.gph, replace
	
clear

*log close






	
